package com.sojson.util.security.shiro.token;

import java.io.Serializable;

import org.apache.shiro.authc.UsernamePasswordToken;

import com.sojson.util.bean.LoginParam;

/**
 * 自定义Token,Shiro的Token的密码是一个字符数组,不方便操作,就重写了
 * 
 * @author liu
 * @date 2020-08-08
 */
public class CustomToken extends UsernamePasswordToken implements Serializable {

    private static final long serialVersionUID = -6451794657814516274L;

    /** 帐号密码登录 */
    public static final int SIMPLE_LOGIN = 1;
    /** 第三方登录 */
    public static final int OTHER_LOGIN = 2;
    /** 登录的类型 */
    private Integer loginType;
    /** 登录的参数 */
    private LoginParam loginParam;
    /** 登录密码[字符串类型] 因为父类是char[] ] **/
    private String pwd;

    /** 构造方法 */
    public CustomToken(String username, String password) {
        super(username, password);
        this.pwd = password;
    }

    /** 构造方法 */
    public CustomToken(String username, String password, boolean rememberMe) {
        super(username, password, rememberMe);
        this.pwd = password;
    }

    /** 构造方法 */
    public CustomToken(String username, String password, boolean rememberMe, String host) {
        super(username, password, rememberMe, host);
        this.pwd = password;
    }

    /**
     * 获取登录类型
     * 
     * @return
     */
    public Integer getLoginType() {
        return loginType;
    }

    /**
     * 设置登录类型
     * 
     * @param loginType
     */
    public void setLoginType(Integer loginType) {
        this.loginType = loginType;
    }

    /**
    * 获取登录的参数
    *
    * @return
    */
    public LoginParam getLoginParam() {
        return loginParam;
    }

    /**
    * 设置登录的参数
    *
    * @param loginParam
    */
    public void setLoginParam(LoginParam loginParam) {
        this.loginParam = loginParam;
    }

    /** 获取密码 */
    public String getPwd() {
        return pwd;
    }

    /** 设置密码 */
    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

}